﻿using LPBToolsLib;
using StationSer;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace DExSerConsoleV1
{
    public class DExSerConsoleCFG
    {
        public Recorder_Error ErrRecorder { get; set; } = null;
        protected JSONINISettings BaseSetCFG { get; set; } = null;
        public DExSerConsoleCFG(JSONINISettings tBaseSetCFG)
        {
            if (tBaseSetCFG != null)
                BaseSetCFG = tBaseSetCFG;
        }

        [DisplayName("命令服务器端口")]
        public int CommandSerPort
        {
            get
            {
                int iDefault = 7754;
                if (BaseSetCFG != null)
                    return BaseSetCFG.getCFGValue<int>("Base", "CommandSerPort", iDefault);
                return iDefault;
            }
            set { BaseSetCFG?.setCFGValue("Base", "CommandSerPort", value); }
        }


        [DisplayName("DExServer服务器UDP端口")]
        public int DExSerUDPPort
        {
            get
            {
                int iDefault = 5931;
                if (BaseSetCFG != null)
                    return BaseSetCFG.getCFGValue<int>("Base", "DExSerUDPPort", iDefault);
                return iDefault;
            }
            set { BaseSetCFG?.setCFGValue("Base", "DExSerUDPPort", value); }
        }


        [DisplayName("DExServer服务器绑定IP")]
        public string DExSerSerIP
        {
            get
            {
                string iDefault = IPAddress.Any.ToString();
                if (BaseSetCFG != null)
                    return BaseSetCFG.getCFGValue<string>("Base", "DExSerSerIP", iDefault);
                return iDefault;
            }
            set { BaseSetCFG?.setCFGValue("Base", "DExSerSerIP", value); }
        }
    }
}
